<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가 
?>
<script>
var member_skin_path = "<?=$member_skin_path?>";
</script>
<script language="javascript" src="<?=$member_skin_path?>/ajax_register_form.js"></script>
<script language="javascript" src="<?=$g4[path]?>/js/md5.js"></script>
<script language="javascript" src="<?=$g4[path]?>/js/prototype.js"></script>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<form name=fregisterform method=post action="javascript:fregisterform_submit(document.fregisterform);" enctype="multipart/form-data" autocomplete="off">
<tbody><tr>
<input type=hidden name=w                value="<?=$w?>">
<input type=hidden name=url              value="<?=$urlencode?>">
<input type=hidden name=mb_id_enabled    value="" id="mb_id_enabled">
<input type=hidden name=mb_nick_enabled  value="" id="mb_nick_enabled">
<input type=hidden name=mb_email_enabled value="" id="mb_email_enabled">
<input type=hidden name=token value="<?=$token?>">
<td><img width="708" height="45" src="../images/sub_contents_title_join.gif"/></td>
</tr>
<tr>
<td><img width="747" height="17" src="../images/sub_contents_title_tail.gif"/></td>
</tr>
<tr>
<td><img width="708" height="94" src="../images/sub_contents_join_preview.jpg"/></td>
</tr>
<tr>
<td>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tbody><tr>
<td width="19" valign="top"><img width="19" height="573" src="../images/sub_contents_tail_left.gif"/></td>
<td valign="top"><table width="100%" cellspacing="0" cellpadding="0" border="0">
<tbody><tr>
<td width="13" height="30"><img width="1" height="1" src="../images/blank.gif"/></td>
<td height="30"><img width="1" height="1" src="../images/blank.gif"/></td>
</tr>
<tr>
<td><img width="1" height="1" src="../images/blank.gif"/></td>
<td><table width="677" cellspacing="0" cellpadding="0" border="0">
<tbody><tr>
<td width="677" valign="top" height="40" background="../images/sub_join_form_bg.gif"><img width="677" height="29" src="../images/sub_join_form_title_01.gif"/></td>
</tr>
<tr>
<td background="../images/sub_join_form_bg.gif"><table width="100%" cellspacing="0" cellpadding="0" border="0">
<tbody><tr>
<td width="40"><img width="1" height="1" src="../images/blank.gif"/></td>
<td><table width="100%" cellspacing="0" cellpadding="0" border="0" class="font">
<tbody><tr>
<td width="133" height="30"><img width="94" height="13" src="../images/sub_join_form_field_01.gif"/></td>
<td>
                <input name=mb_name itemname="이름" value="<?=$member[mb_name]?>" <?=($w=="")?"required":"";?> <?=$member[mb_name]?"readonly class=m_text2":"class=m_text";?>> 
</td>
</tr>
<tr>
<td width="133" height="30"><img width="94" height="13" alt="" src="../images/sub_join_form_field_02.gif"/></td>
<td>
                <input class=m_text type=text id='reg_mb_nick' name='mb_nick' maxlength=20 <?=($w=="")?"required":"";?> value='<?=$member[mb_nick]?>'
                    onkeyup="reg_mb_nick_check();">
                <span id='msg_mb_nick'></span>

</td>
</tr>
<? if ($member[mb_sex]) { ?>
<input type=hidden name=mb_sex value='<?=$member[mb_sex]?>'>
<? } else { ?>
<tr><td width="133" height="30"><img width="94" height="13" alt="" src="../images/sub_join_form_field_03.gif"/></td>
                <TD>
                    <select id=mb_sex name=mb_sex required itemname='성별'>
                    <option value=''>선택하세요
                    <option value='F'>여자
                    <option value='M'>남자
                    </select>
                    <script language="JavaScript">//document.getElementById('mb_sex').value='<?=$member[mb_sex]?>';</script>
                    </td>
            </TR>
        <? } ?>
<tr>
<td width="133" height="30"><img width="94" height="13" alt="" src="../images/sub_join_form_field_04.gif"/></td>
<td>
                <input class=m_text maxlength=20 size=20 id='reg_mb_id' name="mb_id" <?=($w=="")?"required":"";?> value="<?=$member[mb_id]?>" <? if ($w=='u') { echo "readonly style='background-color:#dddddd;'"; } ?>
                <? if ($w=='') { echo "onkeyup='reg_mb_id_check();'"; } ?>>
                <span id='msg_mb_id'></span>
</td>
</tr>
<tr>
<td width="133" height="30"><img width="94" height="13" alt="" src="../images/sub_join_form_field_05.gif"/></td>
<td><INPUT class=m_text type=password name="mb_password" size=20 maxlength=20 <?=($w=="")?"required":"";?> itemname="패스워드"></TD>
</td>
</tr>
<tr>
<td width="133" height="30"><img width="94" height="13" alt="" src="../images/sub_join_form_field_06.gif"/></td>
<td><INPUT class=m_text type=password name="mb_password_re" size=20 maxlength=20 <?=($w=="")?"required":"";?> itemname="패스워드 확인"></td>
</tr>
<tr>
<td width="133" height="30"><img width="94" height="13" alt="" src="../images/sub_join_form_field_07.gif"/></td>

<!-- TODO : 수정시엔 암호화 시켜서 보여줘야...-->
<td><input type="text" class="m_text" maxlength="13" size="16" id="basic" name="mb_jumin" value="<?
    if($member[mb_jumin]) {
       echo substr($member[mb_jumin], 0, 6).'-'.'*******'; 
       echo '" readonly="readonly" style="background-color:#dddddd;';  
    }?>"/> * '-'를 제외하고 13자리로 써주세요.</td>
</tr>
<tr>
<td width="133" height="30"><img width="94" height="13" alt="" src="../images/sub_join_form_field_08.gif"/></td>
<td>
<input id="" class="m_text" type="text" readonly="readonly" name="mb_zip1" value="<?=$member[mb_zip1]?>" size="3" maxlength="3" 
onclick="win_zip('fregisterform', 'mb_zip1', 'mb_zip2', 'mb_addr1', 'mb_addr2');"/>
-
<input id="" class="m_text" type="text" readonly="readonly" name="mb_zip2" size="3" value="<?=$member[mb_zip2]?>" maxlength="3" 
onclick="win_zip('fregisterform', 'mb_zip1', 'mb_zip2', 'mb_addr1', 'mb_addr2');"/>
<a href="javascript:;" onclick="win_zip('fregisterform', 'mb_zip1', 'mb_zip2', 'mb_addr1', 'mb_addr2');">
<img width="91" height="20" border="0" align="absmiddle" src="../skin/member/basic/img/post_search_btn.gif"/></a>
</td>
</tr>
<tr>
<td width="133" height="30"><img width="94" height="13" alt="" src="../images/sub_join_form_field_09.gif"/></td>
<td>
<input id="" class="m_text" type="text" readonly="readonly" name="mb_addr1" value="<?=$member[mb_addr1]?>" size="40" maxlength="1000" onclick="win_zip('fregisterform', 'mb_zip1', 'mb_zip2', 'mb_addr1', 'mb_addr2');"/>
<input id="" class="m_text" type="text" name="mb_addr2" value="<?=$member[mb_addr2]?>" size="40" maxlength="1000"/>
</td></tr>

<tr>
<td width="133" height="30"><img width="94" height="13" alt="" src="../images/sub_join_form_field_10.gif"/></td>
<td>
                <input class=m_text type=text id=mb_birth name='mb_birth' size=8 maxlength=8 minlength=8 required numeric itemname='생년월일' value='<?=$member[mb_birth]?>' readonly title='옆의 달력 아이콘을 클릭하여 날짜를 입력하세요.'>
                    <a href="javascript:win_calendar('mb_birth', document.getElementById('mb_birth').value, '');"><img src='<?=$member_skin_path?>/img/calendar.gif' border=0 align=absmiddle title='달력 - 날짜를 선택하세요'></a></TD>
</tr>



</tbody></table></td>
</tr>
</tbody></table></td>
</tr>
<tr>
<td><img width="677" height="9" src="../images/sub_join_form_bottom.gif"/></td>
</tr>
<tr>
<td height="15"><img width="1" height="1" src="../images/blank.gif"/></td>
</tr>
<tr>
<td valign="top" height="40" background="../images/sub_join_form_bg.gif"><img width="677" height="33" src="../images/sub_join_form_title_02.gif"/></td>
</tr>
<tr>
<td background="../images/sub_join_form_bg.gif"><table width="100%" cellspacing="0" cellpadding="0" border="0">
<tbody><tr>
<td width="40"><img width="1" height="1" src="../images/blank.gif"/></td>
<td><table width="100%" cellspacing="0" cellpadding="0" border="0">
<tbody><tr>
<td width="133" height="30"><img width="94" height="13" src="../images/sub_join_form_field_11.gif"/></td>
<td><input class="m_text" type="text" id="mb_mom_name" name="mb_mom_name" value="<?
    if($member[mb_mom_name]) {
       echo $member[mb_mom_name]; 
       echo '" readonly="readonly" style="background-color:#dddddd;';  
    }?>"/></td>

</tr>
<tr>
<td width="133" height="30"><img width="94" height="13" alt="" src="../images/sub_join_form_field_12.gif"/></td>
<td><input type="password" class="m_text"  id="basic" name="mb_code" value="<?=$member['mb_code']?>"/> 
* 수업 후 학생의 학습평가를 확인시 사용합니다.</td>
</tr>
<tr>
<td width="133" height="30"><img width="94" height="13" alt="" src="../images/sub_join_form_field_13.gif"/></td>
<td><input class="m_text" type="text" maxlength="4" size="4" id="basic" name="mb_relation" value="<?=$member['mb_relation']?>"/></td>
</tr>
<tr>
<td width="133" height="30"><img width="94" height="13" alt="" src="../images/sub_join_form_field_14.gif"/></td>
<td>
<input type=hidden name='old_email' value='<?=$member[mb_email]?>'>
                <input class=m_text type=text id='reg_mb_email' name='mb_email' size=38 maxlength=100 value='<?=$member[mb_email]?>'
                    onkeyup="reg_mb_email_check()">
                <span id='msg_mb_email'></span>
</td>
</tr>
<tr>
<td width="133" height="30"><img width="94" height="13" alt="" src="../images/sub_join_form_field_15.gif"/></td>
<td><input class=m_text type=text name='mb_tel' size=21 maxlength=20 <?=$config[cf_req_tel]?'required':'';?> itemname='전화번호' value='<?=$member[mb_tel]?>'> * 지역번호와 '-'를 포함하여 기재해주세요.</TD>
</tr>
<tr>
<td width="133" height="30"><img width="94" height="13" alt="" src="../images/sub_join_form_field_16.gif"/></td>
<td><input class=m_text type=text name='mb_tel2' size=21 maxlength=20 itemname='추가전화번호' value='<?=$member[mb_tel2]?>'> * 지역번호와 '-'를 포함하여 기재해주세요.</TD>
</tr>
<tr>
<td width="133" height="30"><img width="94" height="13" alt="" src="../images/sub_join_form_field_17.gif"/></td>
<TD><input class=m_text type=text name='mb_hp' size=21 maxlength=20 <?=$config[cf_req_hp]?'required':'';?> itemname='핸드폰번호' value='<?=$member[mb_hp]?>'></TD>
</tr>
</tbody></table></td>
</tr>
</tbody></table></td>
</tr>
<tr>
<td><img width="677" height="9" src="../images/sub_join_form_bottom.gif"/></td>
</tr>
<tr>
<td height="15"><img width="1" height="1" src="../images/blank.gif"/></td>
</tr>
<tr>
<td valign="top" height="40" background="../images/sub_join_form_bg.gif"><img width="677" height="34" src="../images/sub_join_form_title_03.gif"/></td>
</tr>

<tr>
<td background="../images/sub_join_form_bg.gif"><table width="100%" cellspacing="0" cellpadding="0" border="0">
<tbody><tr>
<td width="40"><img width="1" height="1" src="../images/blank.gif"/></td>
<td><table width="100%" cellspacing="0" cellpadding="0" border="0" class="font">
<tbody>
<!--<tr>
<td width="150" height="30"><img width="133" height="13" src="../images/sub_join_form_field_18.gif"/></td>
<td><input type="radio" value="radio" id="radio" name="radio"/>
수신/
 <input type="radio" value="radio" id="radio" name="radio"/> 
거부
</td>
</tr>
-->
        <TR>
            <TD width="160" background="../images/sub_join_form_bg.gif">
            <img src="../images/sub_join_form_field_20.gif"/></TD>
            <TD><input type=checkbox name=mb_mailling value='1' <?=($w=='' || $member[mb_mailling])?'checked':'';?>>정보 메일을 받겠습니다.</TD>
        </TR>
        <TR>
            <TD width="160" background="../images/sub_join_form_bg.gif">
            <img src="../images/sub_join_form_field_21.gif"/></TD>
            <TD><input type=checkbox name=mb_sms value='1' <?=($w=='' || $member[mb_sms])?'checked':'';?>>핸드폰 문자메세지를 받겠습니다.</TD>
        </TR>

        <TR>
            <TD width="160" background="../images/sub_join_form_bg.gif">
            <img src="../images/sub_join_form_field_22.gif"/></TD>
            <TD><input type=text class="m_text" name=mb_refund_bank value='<?=$member['mb_refund_bank']?>'></td>
        </TR>

        <TR>
            <TD width="160" background="../images/sub_join_form_bg.gif">
            <img src="../images/sub_join_form_field_23.gif"/></TD>
            <TD><input type=text class="m_text" name=mb_refund_account value='<?=$member['mb_refund_account']?>'></td>
        </TR>

</tbody></table></td>
</tr>
</tbody></table></td>
</tr>
<tr>
<td><img width="677" height="9" src="../images/sub_join_form_bottom.gif"/></td>
</tr>
<tr>
<td height="15"><img width="1" height="1" src="../images/blank.gif"/></td>
</tr>
<tr>
<td><div align="center">

<input type=image width="66" height="20" src="../images/sub_join_form_buttom_enter.gif" /></a><img width="5" height="1" src="../images/blank.gif"/><a href="../"><img width="68" height="21" src="../images/sub_join_form_buttom_cancel.gif"/></a></div></td>
</tr>
</tbody></table></td>
</tr>
<tr>
<td width="13"><img width="1" height="1" src="../images/blank.gif"/></td>
<td height="20"><img width="1" height="1" src="../images/blank.gif"/></td>
</tr>
</tbody></table></td>
</tr>
</tbody></table></td>
</tr>
<tr>
<td><img width="747" height="144" border="0" usemap="#Map" src="../images/sub_contents_copy.gif"/>
<map id="Map" name="Map"><area target="_blank" href="http://www.turnway.com/new/introduction/introduce.php" coords="35,76,76,92" shape="rect"/><area target="_blank" href="http://www.turnway.com/new/privacy/ad.php" coords="87,76,145,92" shape="rect"/><area target="_blank" href="http://www.turnway.com/new/privacy/privacy.php" coords="159,77,241,92" shape="rect"/><area target="_blank" href="http://www.turnway.com/new/notice/list.php?tbl_name=notice6" coords="254,77,295,92" shape="rect"/><area target="_blank" href="http://www.turnway.com/new/introduction/location.php" coords="304,76,362,91" shape="rect"/><area target="_blank" href="http://www.turnway.com/" coords="26,33,150,60" shape="rect"/>
</map></td>
</tr>
<tr>
<td height="20"><img width="1" height="1" src="../images/blank.gif"/></td>
</tr>
</tbody></table>


















<!--------------------------여기서부터 옛날꺼---------->

<style type="text/css">
<!--
.m_title    { BACKGROUND-COLOR: #F7F7F7; PADDING-LEFT: 15px; PADDING-top: 5px; PADDING-BOTTOM: 5px; }
.m_padding  { PADDING-LEFT: 15px; PADDING-BOTTOM: 5px; PADDING-TOP: 5px; }
.m_padding2 { PADDING-LEFT: 0px; PADDING-top: 5px; PADDING-BOTTOM: 0px; }
.m_padding3 { PADDING-LEFT: 0px; PADDING-top: 5px; PADDING-BOTTOM: 5px; }
.m_text     { BORDER: #D3D3D3 1px solid; HEIGHT: 18px; BACKGROUND-COLOR: #ffffff; }
.m_text2    { BORDER: #D3D3D3 1px solid; HEIGHT: 18px; BACKGROUND-COLOR: #dddddd; }
.m_textarea { BORDER: #D3D3D3 1px solid; BACKGROUND-COLOR: #ffffff; WIDTH: 100%; WORD-BREAK: break-all; }
.w_message  { font-family:돋움; font-size:9pt; color:#4B4B4B; }
.w_norobot  { font-family:돋움; font-size:9pt; color:#BB4681; }
.w_hand     { cursor:pointer; }
-->
</style>
<script language="Javascript">

// submit 최종 폼체크
function fregisterform_submit(f) 
{
    // 회원아이디 검사
    if (f.w.value == "") {
        reg_mb_id_check();
        if ($F('mb_id_enabled')!='000') {
            alert('회원아이디를 입력하지 않았거나 입력에 오류가 있습니다.');
            $('reg_mb_id').activate();
            return;
        }
    }

    if (f.w.value == '') {
        if (f.mb_password.value.strip().length < 3) {
            alert('패스워드를 3글자 이상 입력하십시오.');
            f.mb_password.activate();
            return;
        }
    }

    if (f.mb_password.value != f.mb_password_re.value) {
        alert('패스워드가 같지 않습니다.');
        f.mb_password_re.activate();
        return;
    }

    if (f.mb_password.value.strip().length > 0) {
        if (f.mb_password_re.value.strip().length < 3) {
            alert('패스워드를 3글자 이상 입력하십시오.');
            f.mb_password_re.activate();
            return;
        }
    }
/*
    if (f.mb_password_q.value.strip().length < 1) {
        alert('패스워드 분실시 질문을 선택하거나 입력하십시오.');
        f.mb_password_q.activate();
        return;
    }

    if (f.mb_password_a.value.strip().length < 1) {
        alert('패스워드 분실시 답변을 입력하십시오.');
        f.mb_password_a.activate();
        return;
    }
*/
    // 이름 검사 부모님 + 학생
    if (f.w.value=='') {
        if (f.mb_name.value.strip().length < 1) {
            alert('학생 이름을 입력하십시오.');
            f.mb_name.activate();
            return;
        }

        var pattern = /([^가-힣\x20])/i; 
        if (pattern.test(f.mb_name.value)) {
            alert('학생 이름은 한글로 입력하십시오.');
            f.mb_name.activate();
            return;
        }
        
        if (f.mb_mom_name.value.strip().length < 1) {
            alert('부모님 성함을 입력하십시오.');
            f.mb_mom_name.activate();
            return;
        }

        var pattern = /([^가-힣\x20])/i; 
        if (pattern.test(f.mb_mom_name.value)) {
            alert('부모님 이름은 한글로 입력하십시오.');
            f.mb_mom_name.activate();
            return;
        }
        
        if(f.mb_jumin.value.strip().length < 1) {
            alert('주민등록번호는 필수항목입니다.');
            f.mb_jumin.activate();
            return;
        }

        if(f.mb_code.value.strip().length < 1) {
            alert('부모님 비밀번호는 필수항목입니다.');
            f.mb_code.activate();
            return;
        }
    }
   
    if(f.mb_hp.value.strip().length < 1) {
        alert('휴대폰 번호는 필수항목입니다.');
        f.mb_hp.activate();
        return;
    }

    if(f.mb_tel.value.strip().length < 1) {
        alert('전화번호는 필수항목입니다.');
        f.mb_tel.activate();
        return;
    }


    if((f.mb_zip1.value.strip().length < 1) || (f.mb_zip2.value.strip().length < 1)) {
        alert('우편번호는 필수항목입니다.');
        f.mb_zip1.activate();
        return;
    }


    if(f.mb_addr1.value.strip().length < 1) {
        alert('주소는 필수항목입니다.');
        f.mb_addr1.activate();
        return;
    }
    
    // 별명 검사
    if ((f.w.value == "") ||
        (f.w.value == "u" && f.mb_nick.defaultValue != f.mb_nick.value)) {

        reg_mb_nick_check();

        if ($F('mb_nick_enabled')!='000') {
            alert('별명을 입력하지 않았거나 입력에 오류가 있습니다.');
            $('reg_mb_nick').activate();
            return;
        }
    }

    // E-mail 검사
    if ((f.w.value == "") ||
        (f.w.value == "u" && f.mb_email.defaultValue != f.mb_email.value)) {

        reg_mb_email_check();

        if ($F('mb_email_enabled')!='000') {
            alert('E-mail을 입력하지 않았거나 입력에 오류가 있습니다.');
            $('reg_mb_email').activate();
            return;
        }

        // 사용할 수 없는 E-mail 도메인
        var domain = prohibit_email_check(f.mb_email.value);
        if (domain) {
            alert("'"+domain+"'은(는) 사용하실 수 없는 메일입니다.");
            $('reg_mb_email').activate();
            return;
        }
    }

    if (typeof(f.mb_birth) != 'undefined') {
        if (f.mb_birth.value.strip().length < 1) {
            alert('달력 버튼을 클릭하여 생일을 입력하여 주십시오.');
            //f.mb_birth.activate();
            return;
        }
    }

    if (typeof(f.mb_sex) != 'undefined') {
        if (f.mb_sex.value == '') {
            alert('성별을 선택하여 주십시오.');
            f.mb_sex.activate();
            return;
        }
    }

    if (typeof f.mb_icon != 'undefined') {
        if (f.mb_icon.value) {
            if (!f.mb_icon.value.toLowerCase().match(/.(gif)$/i)) {
                alert('회원아이콘이 gif 파일이 아닙니다.');
                f.mb_icon.activate();
                return;
            }
        }
    }


    <?
    if ($g4[https_url])
        echo "f.action = '$g4[https_url]/$g4[bbs]/register_form_update.php';";
    else
        echo "f.action = './register_form_update.php';";
    ?>

    // 보안인증관련 코드로 반드시 포함되어야 합니다.
    set_cookie("<?=md5($token)?>", "<?=base64_encode($token)?>", 1, "<?=$g4['cookie_domain']?>");

    f.submit();
}

// 금지 메일 도메인 검사
function prohibit_email_check(email)
{
    email = email.toLowerCase();

    var prohibit_email = "<?=trim(strtolower(preg_replace("/(\r\n|\r|\n)/", ",", $config[cf_prohibit_email])));?>";
    var s = prohibit_email.split(",");
    var tmp = email.split("@");
    var domain = tmp[tmp.length - 1]; // 메일 도메인만 얻는다

    for (i=0; i<s.length; i++) {
        if (s[i] == domain)
            return domain;
    }
    return "";
}
</script>
